import requests from './request.js'

// 获取验证码
export function getCaptchaImg() {
	return requests({
		url: '/code',
		headers: {
			isToken: false
		},
		method: 'get',
		timeout: 20000
	})
}

// 查询用户列表
export function getUserList(query, searchUserForm) {
	return requests({
		url: '/system/user/getUserTableData',
		method: 'get',
		params: {
			...query,
			...searchUserForm
		}
	})
}

// 通过用户id查询用户
export function getUserByUid(uid) {
	return requests({
		url: '/system/user/getUserDetail/' + uid,
		method: 'get'
	})
}

// 通过用户id获取编辑数据
export function getModifyUserByUid(uid) {
	return requests({
		url: '/system/user/getUserModifyForm/' + uid,
		method: 'get'
	})
}

// 添加用户
export function addUser(userInfo) {
	return requests({
		url: '/system/user/addUser',
		method: 'post',
		data: userInfo
	})
}

// 修改用户
export function updateUserInfo(modifyUserForm) {
	return requests({
		url: '/system/user/modifyUser',
		method: 'put',
		data: modifyUserForm
	})
}

// 通过用户id删除用户
export function deleteUserByUid(uid) {
	return requests({
		url: '/system/user/deleteUser/' + uid,
		method: 'delete'
	})
}
